// 背景动画效果
<template>
  <ul class="slid-box">
    <li></li>
    <li></li>
    <li></li>
    <li></li>
  </ul>
</template>
<style lang="scss" scoped>
.slid-box {
  position: fixed;
  width: 100%;
  height: 100%;
  background: rgba(21, 49, 209, 0.7);
  top: 0;
  left: 0;
  z-index: 0;
  li {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0px;
    left: 0px;
    opacity: 0;
    z-index: 0;
    background-size: cover; // 把背景图像扩展至足够大，以使背景图像完全覆盖背景区域
    background-position: 50% 50%; // 背景图垂直居中
    background-repeat: none;
    // 给每一个li设置不同的背景图片 并设置相应delay
    &:nth-child(1) {
      background-image: url('../../assets/images/bgAnimation/bg-4.jpg');
    }
    &:nth-child(2) {
      background-image: url('../../assets/images/bgAnimation/bg-5.jpg');
      animation-delay: 12s;
    }
    &:nth-child(3) {
      background-image: url('../../assets/images/bgAnimation/bg-2.jpg');
      animation-delay: 24s;
    }
    &:nth-child(4) {
      background-image: url('../../assets/images/bgAnimation/bg-4.jpg');
      animation-delay: 36s;
    }
    animation: imgAnimation 48s linear infinite 0s;
  }
}
@keyframes imgAnimation {
  0% {
    opacity: 0;
    animation-timing-function: ease-in;
  }
  8% {
    opacity: 1;
    animation-timing-function: ease-out;
  }
  17% {
    opacity: 1;
    transform: scale(1.2);
  }
  25% {
    opacity: 0;
    transform: scale(1.3);
  }
  100% {
    opacity: 0;
  }
}
</style>
<script>
export default {
  name: 'bgAnimation',
}
</script>
